package OOPAndMultiThreadArchiveManager.Client.Tools;

import java.io.IOException;
import java.util.Properties;

public class PropertiesLoader {
    public static int fileUploadPort = 0;
    public static String fileUploadHost = "";
    public static int fileDownloadPort = 0;
    public static String fileDownloadHost = "";
    public static int connectPort = 0;
    public static String connectHost = "";

    public void getProperties() {
        try {
            var inputStream = this.getClass().getClassLoader().getResourceAsStream("Client.properties");
            var properties = new Properties();
            properties.load(inputStream);
            fileUploadPort = Integer.parseInt(properties.get("FileUploadPort").toString());
            fileUploadHost = properties.get("FileUploadHost").toString();
            fileDownloadPort = Integer.parseInt(properties.get("FileDownloadPort").toString());
            fileDownloadHost = properties.get("FileDownloadHost").toString();
            connectPort = Integer.parseInt(properties.get("ConnectPort").toString());
            connectHost = properties.get("ConnectHost").toString();
        } catch (IOException e) {
            System.out.println("Properties error.");
        }
    }
}
